Review


Problem 1
Compute the table of variables and the output of the code shown. Suppose there is a textbox called tbx1 with the property of multiline. Create a program called Luisa to verify your results.
Calcule la tabla de variables y la salida del código de abajo. Suponga que hay una caja de texto llamada tbx1 con la propiedad de multilínea. Cree un programa llamado Luisa para verificar sus resultados.

Luisa.h
#pragma once //______________________________________ Luisa.h
#include "resource.h"

class Luisa: public Win::Dialog
{
public:
     Luisa()
     {
          pies = 12;
          peso = 5.2;
     }
     ~Luisa()
     {
     }
     int pies;
     double peso;
     double Modificar();
     void Calcular(double x);
     . . .
};

Luisa.cpp

void Luisa::Window_Open(Win::Event& e)
{
     wstring texto;
     int n = 2*pies;
     double y=10.0, z=5.0;
     Modificar();
     y = Modificar();
     Calcular(z);
     Sys::Format(texto, L"%.2f, %.1f, %i, %.0f", y, z, n, peso);
     tbx1.Text = texto;
}

double Luisa::Modificar()
{
     peso+=5;
     return 10.5;
}

void Luisa::Calcular(double x)
{
     peso = 2*x+pies;
}

VariableTableModificar

Problem 2
Compute the table of variables and the output of the code shown. Create a program called Pluton to verify your results.
Calcule la tabla de variables y la salida del código de abajo. Cree un programa llamado Pluton para verificar sus resultados.

Pluton.h
#pragma once //______________________________________ Pluton.h
#include "resource.h"

class Pluton: public Win::Dialog
{
public:
     Pluton()
     {
     }
     ~Pluton()
     {
     }
     void AddOpinion();
     void AddDay();
     wstring sentence;
protected:
     . . .
};

Pluton.cpp
void Pluton::Window_Open(Win::Event& e)
{
     sentence = L"Sears sold $800,000.00";
     AddDay();
     AddOpinion();
     this->MessageBox(sentence, L"Message", MB_OK);
}

void Pluton::AddOpinion()
{
     sentence += L" and nobody cares";
}

void Pluton::AddDay()
{
     sentence += L" last wednesday";
}

Problem 3
Create a project called CalculadoraIMC to compute the body mass index as shown. Insert a Level State control in the GUI using Wintempla, do not get confused with the Level control. The control will have four states. Each state requires: an index, a range, a color and a caption. Once the IMC is computed, set the level of the control to the appropriate value to move the arrow. The first table shows the ranges for men and the second table the ranges for women. The IMC is equal to weight over squared height. Click in Wintempla Show All Controls in Toolbox to show all controls in the toolbox.
Cree un proyecto llamado CalculadoraIMC para calcular el índice de masa corporal. Inserte un control Level State en la GUI usando Wintempla, no se confunda con el control de Level. El control tendrá cuatro estados. Cada estado requiere: un índice, un rango, un color y un texto. Una vez que el IMC sea calculado, fija el valor de nivel del control al valor apropiado para mover la flecha indicadora. La primera tabla muestra los rangos para los hombres y la segunda tabla los rangos para mujeres. El IMC es igual al peso sobre la altura al cuadrado. Haga clic en Wintempla en Show All Controls in Toolbox para mostrar todos los controles.

  Minimum    Maximum    Man  
0.020.5Bajo Peso (low weight)
20.525.5Normal
25.530.5Sobrepeso (over weight)
30.545.0Obesidad (obesity)

  Minimum    Maximum    Woman  
0.020.5Bajo Peso (low weight)
20.524.5Normal
24.529.5Sobrepeso (over weight)
29.545.0Obesidad (obesity)

CalculadoraIMC

Problem 4
Create project called Calculadora to perform the basic arithmetic operations as shown.
Cree un programa llamado Calculadora para realizar las operaciones aritméticas básicas.

Calculadora.h
#pragma once //______________________________________ Calculadora.h
#include "resource.h"

#define ADD 1
#define SUBSTRACT 2
#define PRODUCT 3
#define DIVISION 4
#define NO_OPER 5
class Calculadora: public Win::Dialog
{
public:
     Calculadora()
     {
          firstValue = 0.0;
          operation = NO_OPER;
     }
     ~Calculadora()
     {
     }
     double firstValue;
     int operation;
protected:
     . . .
};

Calculadora

Problem 5
Create a program called Gato as shown. Use buttons to draw and separators for the GUI. The first time any button is clicked, it must display an X. The second button being click must display an O, etc.
Cree un programa llamada Gato como se muestra. Use botones y separadores para la GUI. La primera vez que a cualquier botón se le hace clic, este debe mostrar una X. El segundo botón al que se le hace clic debe mostrar una O, etc.

GatoRun1

GatoRun2

GatoRun3

GatoRun4

rand()

The rand() function generates an integer random value between 0 and RAND_MAX -1. To initialize the random number generator, you must call srand(::GetTickCount()).
La función rand() genera un valor aleatorio entre entre cero y RAND_MAX-1. Para inicializar el generador de números aleatorios, usted debe llamar srand(::GetTickCount()).

Problem 6
Create a program called TriArit as shown. Each the Play button is pressed, the program must randomly generate four numbers and six operations. Then, the user should provide the result in the textbox at the bottom. When the Check button is pressed, the program indicates whether the result is correct or not.
Cree un programa llamada TriArit como se muestra. Cada vez que el botón de Play se presiona, el programa debe generar aleatoriamente cuatro números y seis operaciones. Entonces, el usuario debe proporcionar el resultado en la caja de texto de abajo. Cuando se presiona el botón de Check, el programa indica si el resultado es correcto o no.

TriAritRun1

TriAritRun2

TriAritRun3

TriAritRun4

TriAritRun5

© Copyright 2000-2021 Wintempla selo. All Rights Reserved. Jul 22 2021. Home